package cn.hinglo.wx.controller;

import cn.hinglo.common.annotation.RequestMapping;
import com.jfinal.weixin.sdk.jfinal.MsgControllerAdapter;
import com.jfinal.weixin.sdk.msg.in.InTextMsg;
import com.jfinal.weixin.sdk.msg.in.event.InFollowEvent;
import com.jfinal.weixin.sdk.msg.in.event.InMenuEvent;
import com.jfinal.weixin.sdk.msg.out.OutTextMsg;
import lombok.extern.slf4j.Slf4j;

/**
 * @author HingLo
 * @createTime: 2019/4/29 16:16
 * @description: 消息默认处理类
 */
@Slf4j
@RequestMapping("/wx/msg")
public class MsgController extends MsgControllerAdapter {
    /***
     * 取消关注事件
     * @param inFollowEvent
     */
    @Override
    protected void processInFollowEvent(InFollowEvent inFollowEvent) {

    }

    /***
     * 文本接受事件
     * @param inTextMsg
     */
    @Override
    protected void processInTextMsg(InTextMsg inTextMsg) {
        OutTextMsg outMsg = new OutTextMsg(inTextMsg);
        outMsg.setContent("http://www.lovesws.cn");
        render(outMsg);
    }

    /***
     * 自定义菜单事件
     * @param inMenuEvent
     */
    @Override
    protected void processInMenuEvent(InMenuEvent inMenuEvent) {
        renderNull();
    }
}
